<?php
    require_once('lib/JSON.php');

    $JSON = new Services_JSON();

    $raw_post_data = file_get_contents("php://input");

    $input = $JSON->decode($raw_post_data);

    $value = array("success" => false);

    if ($input->request == "comics") {
        $value = array(
            "success" => true,
            "comics" => array(
              array( "date" => "10/31/2006",
                     "url"  => "test/ghostcat.jpg" ),
              array( "date" => "11/01/2006",
                     "url"  => "test/mandelbrot.jpg" )
             )
        );
    }
 
    $output = $JSON->encode($value);

    /* suppress caching activities */
    header("Cache-Control: no-store, no-cache, must-revalidate");
    header("Cache-Control: post-check=0, pre-check=0", false);
    header("Pragma: no-cache");

    /* set JSON- header */
    header("Content-Type: text/json");
    print $output;
?>
